package model;

import java.util.ArrayList;
import java.util.List;

public class RepairType {

	private long ID;
	private String name;
	private String description;
	// link: RepairType 0...*-->0...* RepairType
	private List<RepairType> repairTypes;
	// link: RepairType 1-->0...* SparePartUse
	private List<SparePartUse> sparePartUses;

	/**
	 * 
	 * @param ID
	 * @param name
	 * @param description
	 * 
	 * @author Csaba Tarkanyi
	 */
	public RepairType(long ID, String name, String description) {
		this.ID = ID;
		this.name = name;
		this.description = description;

		repairTypes = new ArrayList<RepairType>();
		sparePartUses = new ArrayList<SparePartUse>();
	}

	/**
	 * @return the iD
	 * @author Stas
	 */
	public long getID() {
		return ID;
	}

	/**
	 * @param id
	 *            the iD to set
	 * 
	 * @author Stas
	 */
	public void setID(long id) {
		ID = id;
	}

	/**
	 * @return the name
	 * 
	 * @author Stas
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 * 
	 * @author Stas
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the description
	 * 
	 * @author Stas
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description
	 *            the description to set
	 * 
	 * @author Stas
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * add RepairTypes
	 * 
	 * @author Stas
	 */
	public void addRepairTypes(RepairType repairType) {
		repairTypes.add(repairType);
	}

	/**
	 * remove RepairTypes
	 * 
	 * @author Stas
	 */
	public void removeRepairTypes(RepairType repairType) {
		repairTypes.remove(repairType);

	}

	/**
	 * @return the repairTypes
	 * 
	 * @author Stas
	 */
	public List<RepairType> getRepairTypes() {
		return repairTypes;
	}

	/**
	 * Adds a SparePartUse.
	 * 
	 * @author Csaba Tarkanyi
	 */
	public void addSparePartUse(SparePartUse spu) {
		sparePartUses.add(spu);
	}

	/**
	 * Removes a SparePartUse.
	 * 
	 * @author Csaba Tarkanyi
	 */
	public void removeSparePartUse(SparePartUse spu) {
		sparePartUses.remove(spu);
	}

	/**
	 * Returns to a List of SparePartUses.
	 * 
	 * @author Csaba Tarkanyi
	 */
	public List<SparePartUse> getSparePartUses() {
		return sparePartUses;
	}

	/**
	 * to string method
	 * 
	 * @author Stas
	 */
	public String toString() {
		return "" + " " + ID + " " + name + " " + description + " "
				+ repairTypes;
	}
}
